﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2.ConvertBinaryToDecimal
{
    class ConvertBinaryToDecimal
    {
        static void Main(string[] args)
        {
            // 1001 = 1*Math.Pow(2,i);
            Console.WriteLine("Input binary number:");
            
            string binary = Console.ReadLine();
            
            int binaryInt = Convert.ToInt32(binary);
            int dec = 0;
            for (int i = 0; i < binary.Length; i++)
            {
                dec += (binaryInt%10) * (int)Math.Pow(2, i);
                binaryInt /= 10;
            }
            Console.WriteLine(dec);
        }
    }
}
